<?php
include '_init_.php';
	$orderManager = Order_Manager::getOrderManager($_REQUEST['id']);
if($orderManager == null)
	exit("Not exist");
if($orderManager->getStatus() != Order_Manager::$STATUS_SAVED)
	exit("Not allowed");
$orderManager->init();


$act = isset($_REQUEST['act'])?$_REQUEST['act']:'';
if($act == 'save')
{
	$orderManager->setInfo($_REQUEST);
	$orderManager->persistOrderInfo();
	AppMain::refreshParentFrame();
}

$orderInfo = $orderManager->getInfo();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/formvalidate.js"></script>
<script language="javascript">
$(function(){
	$('select[name=type] option[value=<?php echo Util::html_safe($orderInfo['type']);?>]').attr('selected',true);
	<?php 

		$orderInfo['benzu_style'] = explode(',',$orderInfo['benzu_style']);
	foreach($orderInfo['benzu_style'] as $tmpData)
	{
	?>
	$('input.jq_selector_benzustyle[value=<?php echo Util::html_safe($tmpData);?>]').attr('checked',true);
	<?php
	}
	?>
	
	<?php
	$estimator = new Order_Estimator($orderManager);
	$catalogSetting = $estimator->getCatalogSetting();
	
	?>
	$('input.jq_selector_benzustyle_cat[value=<?php echo Util::html_safe($catalogSetting['benzu_style']);?>]').attr('checked',true);
});
</script>
</head>

<body>
<form action="cosid.php">
<input type="hidden" name="act" value="save"/>
<input type="hidden" name="id" value="<?php echo $orderManager->getId();?>"/>
<div class="mainf-8">
    <ul>
    <li class="maina-1k">包套資訊</li>
      <li class="mainf-1m"><img src="images/line5.gif" width="676" height="7" align="top" /></li>
     <li class="mainf-1e">預約類別
       <label for="select2"></label>
       <select name="type" class="maine-keyinm" id="select2" >
         <option value="寶寶照">寶寶照</option>
         <option value="全家福">全家福</option>
         <option value="個人照">個人照</option>
       </select>
     </li>
      <li class="mainf-1e">數位光碟<input name="disk_number" type="text"  class="maine-keying _validate_form_int" value="<?php echo Util::html_safe($orderInfo['disk_number']);?>"/>
      組
      </li>
<li class="mainf-1f">相本樣式</li>
		<?php 
			$dtBenzuStype = new DataTable(constant('DB_TABLE_BENZU_STYLE'));
			$benzuStyleList = $dtBenzuStype->get_list();
			foreach($benzuStyleList as $tmpData)
			{
				printf(' <li class="mainf-1c"><input disabled="disabled" type="checkbox" class="jq_selector_benzustyle_cat" value="%s"/>&nbsp;%s</li>',$tmpData['name'],$tmpData['name']);
			}
		?>
     
      <li class="mainf-1e">修改像本增加差價<input name="benzu_customize_price" type="text"  class="maine-keying _validate_form_float" value="<?php echo $orderInfo['benzu_customize_price'];?>"/>&nbsp;元</li>

        
        <li class="mainf-1e">相本數量<input name="benzu_number" type="text"  class="maine-keying _validate_form_int" value="<?php echo Util::html_safe($orderInfo['benzu_number']);?>"/> 
      本</li>
        <li class="mainf-1e2">增加數位光碟<input name="disk_number_add" type="text"  class="maine-keying _validate_form_int" value="<?php echo Util::html_safe($orderInfo['disk_number_add']);?>"/>
      組
      </li>
      <li class="mainf-1f2">相本樣式</li>
      	<?php 
			$dtBenzuStype = new DataTable(constant('DB_TABLE_BENZU_STYLE'));
			$benzuStyleList = $dtBenzuStype->get_list();
			foreach($benzuStyleList as $tmpData)
			{
				printf(' <li class="mainf-1c2"><input  type="checkbox" name="benzu_style[]" value="%s" class="jq_selector_benzustyle"/>&nbsp;%s</li>',$tmpData['name'],$tmpData['name']);
			}
		?>
      
        <li class="mainf-1e2">相本數量<input name="benzu_number" type="text"  class="maine-keying _validate_form_int" value="<?php echo Util::html_safe($orderInfo['benzu_number']);?>"/> 
      本</li>
  
      </ul>
    </div>
    <div class="mainf-7">
<ul>
<li class="article-1g"><input name="" type="button" class="article-1a_btn" value="儲存" onclick="document.forms[0].submit();return false;"/></li>
</ul>
</div>
</form>
</body>
</html>
